package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetMealDishMapper {



    /**
     * 根据菜品id查询套餐id
     * @param dishIds
     * @return
     */
    List<Long> getSetMealIdsByDishIds(List<Long> dishIds);

    /**
     * 添加套餐菜品关系
     * @param setmealDishes
     */
    void insertMealDish(List<SetmealDish> setmealDishes);

    /**
     * 通过套餐id批量删除
     * @param setMealIds
     */
    void deleteBatch(List<Long> setMealIds);

    /**
     * 根据套餐id查询菜品
     */
    @Select("select * from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> getDishIdsBySetmealId(Long setmealId);

    /**
     * 通过套餐id单个删除
     * @param setMealid
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{setMealid}")
    void deleteBySetMeal(Long setMealid);

    /**
     * 批量插入
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);
}
